package com.qiangqiang.resoldhouse.redis;

/**
 * Created by q on 2018/4/2.
 */
public abstract class BasePrefix implements KeyPrefix {

    private String prefix;
    private int expireSecond;


    public BasePrefix(String prefix){
        this(prefix,0);
    }

    public BasePrefix(String prefix, int expireSecond) {
        this.prefix = prefix;
        this.expireSecond = expireSecond;
    }

    /**
     * 0 ：默认永不过期
     * @return
     */
    @Override
    public int expireSecond() {
        return expireSecond;
    }

    @Override
    public String getPrefix() {
        String className=getClass().getSimpleName();
        return className+":"+prefix;
    }
}
